package com.disys.facade;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

import com.disys.dao.Rec220emplpaydtlDAO;
import com.disys.model.Rec140ERWOTCLOC;
import com.disys.model.Rec220emplpaydtl;

public class Rec220emplpaydtlFacade {

	public Rec220emplpaydtlFacade() {
	}

	private Rec220emplpaydtlDAO obj = new Rec220emplpaydtlDAO();

	public List<Rec220emplpaydtl> findAllRecords() {
		List<Rec220emplpaydtl> list = null;
		try {
			obj.beginTransaction();
			list = obj.findAll();
			obj.closeTransaction();
		} catch (IllegalStateException ex) {
			list = obj.findAll();
			obj.closeTransaction();
		}
		if (list.size() == 0 || list == null) {
			return new ArrayList<Rec220emplpaydtl>();
		}
		return list;
	}

	public List<Rec220emplpaydtl> findFinalizeRecords(String object,
			Integer isFinalized, BigInteger pId) {
		// obj.beginTransaction();
		List<Rec220emplpaydtl> list = obj.findFinalizeRecords(object,
				isFinalized,pId);
		// obj.closeTransaction();
		if (list.size() == 0 || list == null) {
			return new ArrayList<Rec220emplpaydtl>();
		}
		return list;
	}

	public void insertRecord(Rec220emplpaydtl entity) {
		// obj.beginTransaction();
		obj.save(entity);
		obj.commitAndCloseTransaction();
	}
	
	public List<Integer> getAllProcessIds(String object) {
		obj.beginTransaction();
		List<Integer> list = obj.getAllProcessIds(object);
		obj.closeTransaction();
		return list;
	}

}
